import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UploadVO, UploadForm, UploadQuery } from '@/api/general/administration/car/upload/types';

/**
 * 查询文件上传信息存储列表
 * @param query
 * @returns {*}
 */

export const listUpload = (query?: UploadQuery): AxiosPromise<UploadVO[]> => {
  return request({
    url: '/system/upload/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询文件上传信息存储详细
 * @param id
 */
export const getUpload = (id: string | number): AxiosPromise<UploadVO> => {
  return request({
    url: '/system/upload/' + id,
    method: 'get'
  });
};

/**
 * 新增文件上传信息存储
 * @param data
 */
export const addUpload = (data: UploadForm) => {
  return request({
    url: '/system/upload',
    method: 'post',
    data: data
  });
};

/**
 * 修改文件上传信息存储
 * @param data
 */
export const updateUpload = (data: UploadForm) => {
  return request({
    url: '/system/upload',
    method: 'put',
    data: data
  });
};

/**
 * 删除文件上传信息存储
 * @param id
 */
export const delUpload = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/upload/' + id,
    method: 'delete'
  });
};
